問題の説明
Python ‑ ビデオ処理。方法: 1) ビデオのピクセル値を変更し (つまり、ピクセル効果)、2) すべてのピクセルの情報を取得します。 (Python ‑ video processing. How to: 1) change pixels value in videos (ie pixelated effect), and then 2) retrieve every single pixel's information)
この質問は、実際の科学プロジェクトに関連しています。1. ビデオは、黒い背景面に対して白い移動オブジェクトを媒体として作成されます。最終結果は白黒出力に近くなりますが、ビデオを実際のデュアル カラー チャネル ビデオ (黒と白のピクセルのみを表示) にレンダリングする必要もあります。ノイズ (光の干渉によって生じる無関係な白いピクセル) を削除/削減することも役立つと思います 2. その後、ピクセル効果を得るためにピクセル値を変更する必要があります 3。まさにこの時点で、すべてのフレームからすべてのピクセル値を取得する必要があります。これらのマトリックスに対して計算計算を実行する必要があるため、おそらくマトリックス形式で配置されます。
例を示します。
リファレンスソリューション
方法 1:
# You could store it in a list like this:
frame1 = [.01110000, .01111001] # and so on. Because an int can't start on zero, I made these decilams
To change the first item in this list do the following
frame1[0] = .01110011 # This will be the new value and the current list looks like this:
frame1 = [.01110011, .01111001]
To retrieve information about every element in the list simply use a for loop
n = ‑1
for element in frame1:
n += 1
element = frame1[n]
print(element)
</code></pre>
(by Enzo 、realFishSam)
リファレンスドキュメント